package com.supermarket_project.controller;

import com.supermarket_project.common.R;
import com.supermarket_project.pojo.subject.Goodsvo;
import com.supermarket_project.pojo.subject.Staffvo;
import com.supermarket_project.service.XiaoshouService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/supermarket/xiaoshou")
@RestController
@CrossOrigin
public class XiaoshouController {

    @Autowired
    XiaoshouService xiaoshouService;

    @PostMapping("/staffinffo")
    public R getAllstaffInfo(@RequestBody Staffvo staffvo){
        String mes = "查询员工成功";

       return R.success(xiaoshouService.getAllstaff_info(staffvo),mes);
    }
    //一级分类查询
    @RequestMapping ("/goodsinffo")
    public R getAllgoodsInfo(){
        String mes = "查询一级分类成功";

        return R.success(xiaoshouService.getAllOneTwoSubject(),mes);
    }
    //二级分类查询
    @PostMapping("/goodsinffo/goodsselect")
    public R getAllgoods(@RequestBody Goodsvo goodsvo){

        String mes = "查询所有商品成功";
        return R.success(xiaoshouService.getgoodsinfo(goodsvo),mes );
    }
}
